import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { ProjectApplyVO, ProjectApplyForm, ProjectApplyQuery } from '@/pagesA/api/workflow/projectApply/types';

/**
 * 查询令讯立项申请书列表
 * @param query
 * @returns {*}
 */

export const listProjectApply = (query?: ProjectApplyQuery): AxiosPromise<ProjectApplyVO[]> => {
  return request({
    url: '/workflow/projectApply/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询令讯立项申请书详细
 * @param id
 */
export const getProjectApply = (id: string | number): AxiosPromise<ProjectApplyVO> => {
  return request({
    url: '/workflow/projectApply/' + id,
    method: 'get'
  });
};

/**
 * 新增令讯立项申请书
 * @param data
 */
export const addProjectApply = (data: ProjectApplyForm) => {
  return request({
    url: '/workflow/projectApply',
    method: 'post',
    data: data
  });
};

/**
 * 修改令讯立项申请书
 * @param data
 */
export const updateProjectApply = (data: ProjectApplyForm) => {
  return request({
    url: '/workflow/projectApply',
    method: 'put',
    data: data
  });
};

/**
 * 删除令讯立项申请书
 * @param id
 */
export const delProjectApply = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/projectApply/' + id,
    method: 'delete'
  });
};
